package com.oschat.controller;

import com.oschat.annotation.GlobalInterceptor;
import com.oschat.entity.po.UserInfoPretty;
import com.oschat.entity.query.UserInfoPrettyQuery;
import com.oschat.entity.query.UserInfoQuery;
import com.oschat.entity.vo.PaginationResultVO;
import com.oschat.entity.vo.ResponseVO;
import com.oschat.service.UserInfoPrettyService;
import com.oschat.service.UserInfoService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * @author Administrator
 * @version 1.0
 * @description: TODO
 * @date 2025/7/30 15:37
 */
@RestController("userInfoBeautyController")
@RequestMapping("/admin")
public class AdminUserInfoBeautyController extends ABaseController {

    @Resource
    private UserInfoPrettyService userInfoPrettyService;

    /**
     * @description: 靓号展示
     * @author Administrator
     * @date 2025/8/14 19:29
     * @version 1.0
     */
    @RequestMapping("/loadBeautyAccountList")
    @GlobalInterceptor(checkAdmin = true)
    public ResponseVO loadBeautyAccountList(UserInfoPrettyQuery query) {
        query.setOrderBy("id desc");
        PaginationResultVO result = userInfoPrettyService.findListByPage(query);
        return getSuccessResponseVO(result);
    }

    @RequestMapping("/saveBeautAccount")
    @GlobalInterceptor(checkAdmin = true)
    public ResponseVO saveBeautyAccount(UserInfoPretty pretty) {
        userInfoPrettyService.saveAccount(pretty);
        return getSuccessResponseVO(null);
    }

    @RequestMapping("/delBeautAccount")
    @GlobalInterceptor(checkAdmin = true)
    public ResponseVO delBeautAccount(@NotNull Integer id) {
        userInfoPrettyService.deleteUserInfoPrettyById(id);
        return getSuccessResponseVO(null);
    }
}
